<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>skywalking</title>
  {% load static %}
  <meta name="description" content="particles.js is a lightweight JavaScript library for creating particles.">
  <meta name="author" content="Vincent Garreau" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <link rel="stylesheet" media="screen" href="{% static "css/style.css" %}">
  <link rel="stylesheet" type="text/css" href="{% static "css/reset.css" %}"/>
  <script src="http://rescdn.qqmail.com/node/ww/wwopenmng/js/sso/wwLogin-1.0.0.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>

<div id="particles-js">
		<div class="login">
			<div class="login-top">
			</div>
			<div class="login-center clearfix">
				<div id="wx_reg" style="text-align:center"></div>
			</div>
		</div>
		<div class="sk-rotating-plane"></div>
</div>

<!-- scripts -->
<script src="{% static "js/particles.min.js" %}"></script>
<script src="{% static "js/app.js" %}"></script>
<script type="text/javascript">
	function hasClass(elem, cls) {
	  cls = cls || '';
	  if (cls.replace(/\s/g, '').length == 0) return false; //当cls没有参数时，返回false
	  return new RegExp(' ' + cls + ' ').test(' ' + elem.className + ' ');
	}

	function addClass(ele, cls) {
	  if (!hasClass(ele, cls)) {
	    ele.className = ele.className == '' ? cls : ele.className + ' ' + cls;
	  }
	}

	function removeClass(ele, cls) {
	  if (hasClass(ele, cls)) {
	    var newClass = ' ' + ele.className.replace(/[\t\r\n]/g, '') + ' ';
	    while (newClass.indexOf(' ' + cls + ' ') >= 0) {
	      newClass = newClass.replace(' ' + cls + ' ', ' ');
	    }
	    ele.className = newClass.replace(/^\s+|\s+$/g, '');
	  }
	}
		document.querySelector(".login-button").onclick = function(){
				addClass(document.querySelector(".login"), "active")
				setTimeout(function(){
					addClass(document.querySelector(".sk-rotating-plane"), "active")
					document.querySelector(".login").style.display = "none"
				},800)
				setTimeout(function(){
					removeClass(document.querySelector(".login"), "active")
					removeClass(document.querySelector(".sk-rotating-plane"), "active")
					document.querySelector(".login").style.display = "block"
					alert("登录成功")

				},5000)
		}
</script>
<div style="text-align:center;">
</div>
</body>

<script>
    var data_dict = eval({{  Dict|safe }});
    window.WwLogin({
            "id" : data_dict['id'],  //显示二维码的容器id
            "appid" : data_dict['appid'],  //企业微信的cropID，在 企业微信管理端->我的企业 中查看
            "agentid" : data_dict['agentid'],  //授权方的网页应用ID，在具体的网页应用中查看
            "redirect_uri" : data_dict['redirect_uri'],  //重定向地址，需要进行UrlEncode
            "state" : data_dict['state'],   //用于保持请求和回调的状态，授权请求后原样带回给企业。该参数可用于防止csrf攻击（跨站请求伪造攻击），建议企业带上该参数
            "href" : "",    //自定义样式链接，企业可根据实际需求覆盖默认样式。详见文档底部FAQ
        });
</script>
</html>
